// 数组的声明方式
//第一种，可以在元素类型后面接上 []，表示由此类型元素组成的一个数组：
let str1: string[] = ["1"]
//第二种方式是使用数组泛型，Array<元素类型>
let str2: Array<string> = ["1"]

// 基本类型数组
const arr: (string | number)[] = [1, 2, "vvv"]
const stringArr: string[] = ["1", "2", "3"]
const numberArr: number[] = [1, 2, 3]
const nullArr: null[] = [null, null]

//对象数组
const objArr: { name: string; age: number }[] = [
  { name: "dell", age: 12 },
  { name: "dali", age: 16 },
]

// type alias 类型别名

type User = {
  name: string
  age: number
}

const userInfor: User[] = [{ name: "dell", age: 12 }]

class Teachers {
  name: string = "dell"
  age: number = 12
  product: string = "mail"
}

const teacherList: Teachers[] = [
  { name: "ff", age: 23, product: "mail" },
  new Teachers(),
]

//元组Tuple的声明（数组的长度和类型固定时，用元组类型)
//表示一个已知元素数量和类型的数组，各元素的类型不必相同
//当csv或者excel数据导入为js时，数据类型就是元组类型
//不能访问越界元素
let tuple1: [string, string, number]
tuple1 = ["f", "f", 123]

// 元组数组
type Tup = [string, string, number]
const tupleArr: Tup[] = [["1", "2", 3]]
